package com.example.common.entity;

import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Data
@Entity
@Table(name = "client_collection")
@IdClass(Collection.PrimaryKey.class)
public class Collection implements Serializable {

    private static final long serialVersionUID = 3408213221255341027L;
    @Id
    @Column(name = "dc_id_bigint", columnDefinition = "bigint(20)")
    private Long dcId;
    @Id
    @Column(name = "client_id_bigint", columnDefinition = "bigint(20)")
    private Long clientId;
    @Column(name = "create_time_datetime", columnDefinition = "datetime(3)")
    private Date createTime;
    @Column(name = "seed_bit", columnDefinition = "tinyint(1)")
    private Boolean seed;

    @Data
    static class PrimaryKey implements Serializable {
        private static final long serialVersionUID = -2602388184877762403L;
        private Long dcId;
        private Long clientId;
    }

}
